import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

public class Main {
    static Random rn = new Random(System.currentTimeMillis());

    public static int getRandomInt(int i) {
        return Math.abs(rn.nextInt()) % i + 1;
    }

    public void test() {

        Solution solution = new Solution();

        String s = getTestInput();

        boolean expected = checkZeroOnes(s);
        boolean actual = solution.checkZeroOnes(s);

        if (expected != actual) {
            String msg = "Test Failed\n";
            msg += "Input:" + s + "\n";
            msg += "Expected:" + expected + "\n";
            msg += "Actual:" + actual;
            throw new RuntimeException(msg);
        }
    }

    public void testSpecial() {

        Solution solution = new Solution();

        String s = "1";

        boolean expected = checkZeroOnes(s);
        boolean actual = solution.checkZeroOnes(s);

        if (expected != actual) {
            String msg = "Test Failed\n";
            msg += "Input:" + s + "\n";
            msg += "Expected:" + expected + "\n";
            msg += "Actual:" + actual;
            throw new RuntimeException(msg);
        }
    }

    private String getTestInput() {
        int n = getRandomInt(100);
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < n; i++) {
            sb.append(ThreadLocalRandom.current().nextInt(10) % 2 == 0 ? "1" : "0");
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        try {
            Main main = new Main();
            for (int i = 0; i < 20; i++) {
                main.test();
            }
            main.testSpecial();
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            System.exit(-1);
        }
    }

    public boolean checkZeroOnes(String s) {
        int a0 = 0, a1 = 0;
        int s0 = 0, s1 = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '1') {
                a1++;
                a0 = 0;
            } else {
                a0++;
                a1 = 0;
            }
            s0 = Math.max(s0, a0);
            s1 = Math.max(s1, a1);
        }
        return s1 > s0;
    }
}
